﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Digitalmes.Model.AndonManagement;
using Digitalmes.Model;



namespace Digitalmes.ViewModel.AndonManagement.AndonStationHeaderVMs
{
    public partial class AndonStationHeaderStationDetailListVM2 : BasePagedListVM<AndonStationHeader, AndonStationHeaderDetailSearcher2>
    {
        
        protected override List<GridAction> InitGridAction()
        {
            return new List<GridAction>
            {
            };
        }
 
        protected override IEnumerable<IGridColumn<AndonStationHeader>> InitGridHeader()
        {
            return new List<GridColumn<AndonStationHeader>>{
                
                this.MakeGridHeader(x => x.HeaderRole).SetEditType(EditTypeEnum.TextBox).SetTitle(@Localizer["Page.职位"].Value),
                this.MakeGridHeader(x => x.Header).SetEditType(EditTypeEnum.TextBox).SetTitle(@Localizer["Page.负责人"].Value),
                this.MakeGridHeader(x => x.ContactNumber).SetEditType(EditTypeEnum.TextBox).SetTitle(@Localizer["Page.联系电话"].Value),

            };
        }

        
        public override IOrderedQueryable<AndonStationHeader> GetSearchQuery()
        {
                
            var id = (long?)Searcher.StationId.ConvertValue(typeof(long?));
            if (id == null)
                return new List<AndonStationHeader>().AsQueryable().OrderBy(x => x.ID);
            var query = DC.Set<AndonStationHeader>()
                .Where(x => id == x.StationId)

                .OrderBy(x => x.ID);
            return query;
        }

    }

    public partial class AndonStationHeaderDetailSearcher2 : BaseSearcher
    {
        
        [Display(Name = "_Model._AndonStationHeader._Station")]
        public string StationId { get; set; }
    }

}

